<template>
  <!-- 实名认证 -->
  <view class="root">
    <view class="root-inner">
      <view class="inner-top">
        <view class="wrapper" v-if="form.carType == 1">
          <yy-title title="维修车辆信息"></yy-title>
          <view class="wrapper-item">
            <view class="label-item">送修原因:</view>
            <view class="content-item"> {{form.faultDescribe}}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">车牌号:</view>
            <view class="content-item">{{ form.carNumber || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">车辆颜色:</view>
            <view class="content-item">{{ form.carColor || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">车架编号:</view>
            <view class="content-item">{{ form.frameNumber || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">发动机编号:</view>
            <view class="content-item">{{ form.engineNumber || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">车辆照片:</view>
            <view style="color: #2488F5;" class="content-item" v-if="form.imageListUrl && form.imageListUrl.length"
              @click="handlePreviewImg(form.imageListUrl)">
              查看
            </view>
            <view class="content-item" v-else>
              暂无
            </view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">是否可疑车辆:</view>
            <view class="content-item"> {{form.isSuspectedVehicle == '1' ? '是' : '否' }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">送修时间:</view>
            <view class="content-item">{{ moment(form.sendRepairTime).format('YYYY/MM/DD HH:mm') || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">送修上报时间:</view>
            <view class="content-item">{{ form.sendRepairEscalationTime || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">取车时间:</view>
            <view class="content-item">{{ moment(form.takeTime).format('YYYY/MM/DD HH:mm') || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">取车上报时间:</view>
            <view class="content-item">{{ form.takeEscalationTime || "暂无" }}</view>
          </view>
        </view>
        <view class="wrapper" v-else>
          <yy-title title="维修车辆信息"></yy-title>
          <view class="wrapper-item">
            <view class="label-item">车架编号:</view>
            <view class="content-item">{{ form.frameNumber || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">车牌号:</view>
            <view class="content-item">{{ form.carNumber || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">品牌型号:</view>
            <view class="content-item">{{ form.carModule || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">车辆照片:</view>
            <view style="color: #2488F5;" class="content-item" v-if="form.imageListUrl && form.imageListUrl.length"
              @click="handlePreviewImg(form.imageListUrl)">
              查看
            </view>
            <view class="content-item" v-else>
              暂无
            </view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">送修时间:</view>
            <view class="content-item">{{ moment(form.sendRepairTime).format('YYYY/MM/DD HH:mm') || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">送修上报时间:</view>
            <view class="content-item">{{ form.sendRepairEscalationTime || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">取车时间:</view>
            <view class="content-item">{{ moment(form.takeTime).format('YYYY/MM/DD HH:mm') || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">取车上报时间:</view>
            <view class="content-item">{{ form.takeEscalationTime || "暂无" }}</view>
          </view>
        </view>
        <view class="wrapper">
          <yy-title title="送修人员信息"></yy-title>
          <view class="wrapper-item">
            <view class="label-item">身份证号:</view>
            <view class="content-item">{{ encryptIDCard(form.sendRepairIdcard) || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">姓 名:</view>
            <view class="content-item">{{ form.sendRepairName || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">手机号码:</view>
            <view class="content-item">{{ form.sendRepairPhone || "暂无" }}</view>
          </view>
        </view>
        <view class="wrapper">
          <yy-title title="取车人员信息"></yy-title>
          <view class="wrapper-item">
            <view class="label-item">身份证号:</view>
            <view class="content-item">{{ encryptIDCard(form.takeIdcard) || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">姓 名:</view>
            <view class="content-item">{{ form.takeName || "暂无" }}</view>
          </view>
          <view class="wrapper-item">
            <view class="label-item">手机号码:</view>
            <view class="content-item">{{ form.takePhone || "暂无" }}</view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
  import {
    electricvehiclesDeleteInfo,
    electricvehiclesDetails,
    getUnlockRecordById
  } from "@/api/api.js";
  import {
    Toast,
    getOptionsParams,
    isLoading,
    navBack,
    navTo,
    previewImage,
    pvwImage,
    encryptIDCard
  } from "@/utils/util.js";
  import moment from "@/utils/moment";

  export default {
    data() {
      return {
        baseImgUrl: this.$baseImgUrl,
        baseURL: this.$baseURL,
        imgPrefix: uni.getStorageSync("imgPrefix"),
        form: {},
        errorType: ["none"],
        routerParams: {}
      };
    },
    onLoad(options) {
      const detail = getOptionsParams(options);
      this.form = detail
    },
    onShow() {},
    methods: {
      encryptIDCard,
      pvwImage,
      moment,
      handleReport() {
        navTo({
          url: '/itemRegistration/lossInformationCar',
          params: {
            id: this.form.id
          }
        })
      },
      handlePreviewImg(urls) {
        previewImage.call(this, urls)
      },
      handleTakeCar() {
        navTo({
          url: '/specialtyBook/maintenanceRecords/takeCar/takeCar',
          params: {
            ...this.form
          }
        })
      }
    },
  };
</script>

<style>
  page {
    background-color: #f3f3f3 !important;
    height: 100%;
  }
</style>
<style lang="scss" scoped>
  .root {
    flex: 1;
    background-color: #f3f3f3;
    height: 100%;

    .root-inner {
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;

      .inner-top {
        flex: 1;
        overflow: auto;
        padding-bottom: 10rpx;
      }
    }

    .inner-bottom {
      flex-shrink: 0;
      height: 120rpx;
      padding: 32rpx;
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: #FFFFFF;

      /deep/.u-button {
        width: 320rpx;
        height: 88rpx;
        border-radius: 44rpx 44rpx 44rpx 44rpx;

        .u-button__text {
          font-size: 36rpx !important;
        }
      }

      .b-cancel {
        color: #000000;
      }

      .b-confirm {
        color: #F9F9F9;
      }
    }

    /deep/.title-s-n {
      padding-top: 20rpx !important;
      padding-bottom: 20rpx !important;
    }

    .wrapper {
      width: 718rpx;
      background: #FFFFFF;
      border-radius: 16rpx 16rpx 16rpx 16rpx;
      margin: 0 auto;
      padding: 0 27rpx;
      margin-top: 10rpx;

      .wrapper-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1rpx solid #F3F0F0;
        padding-top: 48rpx;
        padding-bottom: 21rpx;

        &:last-child {
          border: 0;
        }

        .label-item {
          font-size: 28rpx;
          color: #7F7E83;
          flex-shrink: 0;
          margin-right: 30rpx;
        }

        .content-item {
          font-weight: bold;
          font-size: 28rpx;
          color: #333333;
        }
      }

      .photo-class {
        width: 90rpx;
        height: 56rpx;
      }
    }
  }
</style>